const Koa = require('koa2')
const path = require('path');
//const views = require('koa-views');
const render = require('koa-art-template')
const static = require('koa-static');
const Router = require('koa-router');
//
const { connect } = require('./database/init');

connect();

const app = new Koa();


// app.use(views(path.resolve(__dirname,"./views"),{
//     extension:'ejs'
// }));

render(app,{
    root: path.resolve(__dirname,'./views'),
    extname: '.html',
    debug: process.env.NODE_ENV !== 'production'
});

app.use(static(path.resolve(__dirname,'./static')));

app.use(async (ctx,next)=>{
    await ctx.render('index',{
        me:"world"
    });
});

app.listen(3000);
